package com.atguigu.crowd.funding.entity;

import java.util.ArrayList;
import java.util.List;

public class Menu {
	//主键
    private Integer id;
    //父主键，树形结构的自引用，根节点的pid为空
    private Integer pid;
    //名称
    private String name;
    //图标
    private String icon;
    //路径
    private String url;
    
    //子节点集合，因在数据库中无此属性，建议设初始值（new）,避免null错误
    private List<Menu> children = new ArrayList<Menu>();
    //open用于控制菜单展开/关闭
    private boolean open = true;
    //存储子节点个数
    private Integer length = new Integer(0);
    
    public Menu(){
    	
    }

    public Menu(Integer id, Integer pid, String name, String icon, String url, List<Menu> children, boolean open) {
		super();
    	this.id = id;
		this.pid = pid;
		this.name = name;
		this.icon = icon;
		this.url = url;
		this.children = children;
		this.open = open;
	}



	@Override
	public String toString() {
		return "Menu [id=" + id + ", pid=" + pid + ", name=" + name + ", icon=" + icon + ", url=" + url + ",  open=" + open + "]";
	}

	public List<Menu> getChildren() {
		return children;
	}

	public void setChildren(List<Menu> children) {
		this.children = children;
	}

	public boolean isOpen() {
		return open;
	}

	public void setOpen(boolean open) {
		this.open = open;
	}

	public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon == null ? null : icon.trim();
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url == null ? null : url.trim();
    }

	public Integer getLength() {
		return length;
	}

	public void setLength(Integer length) {
		this.length = length;
	}
    
}